<?php
/**
 * Created by JetBrains PhpStorm.
 * User: adilet
 * Date: 14.08.13
 * Time: 11:13
 * To change this template use File | Settings | File Templates.
 */

class Tourism_AdminClimateController extends Core_Controller_Action_Admin
{
  public function indexAction()
  {

  }

  public function createAction()
  {
    $this->view->form = $form = new Tourism_Form_Cities_Create();

    if ($this->getRequest()->isPost()) {
      if ($form->isValid($this->getRequest()->getPost())) {
        $citiesTable = Engine_Api::_()->getDbTable('climate', 'tourism');
        /**
         * @var $citiesTable Tourism_Model_DbTable_Cities
         */
        $city = $citiesTable->createRow();
        $city->setFromArray($form->getValues());
        $city->setPhoto($form->photo);
        $city->save();
        return $this->_helper->redirector->gotoRoute(array('module' => 'tourism', 'controller' => 'cities', 'action' => 'index'), 'admin_default', true);
      }
    }
  }

  public function listAction()
  {

  }

  public function editAction()
  {

  }

  public function deleteAction()
  {

  }
}